home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / media-list.xml < prev    next >
Extensible Markup Language  |  2010-01-15  |  5KB  |  222 lines

  1. <?xml version="1.0"?>
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5. <!DOCTYPE bindings SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  6.  
  7. <bindings xmlns="http://www.mozilla.org/xbl"
  8.     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9.     xmlns:html="http://www.w3.org/1999/xhtml"
  10.     xmlns:xbl="http://www.mozilla.org/xbl">
  11.  
  12.     <binding id="MediaList" extends="widgets.xml#widget">
  13.  
  14.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  15.             <tree 
  16.                 anonid="xTree"
  17.                 id="dwhelper-media-list"
  18.                 flex="1"
  19.                 enableColumnDrag="true" 
  20.                 hidecolumnpicker="false"
  21.                 flags="dont-build-content" 
  22.                 datasources="rdf:null" 
  23.                 ref="urn:none"
  24.                 >
  25.                 
  26.                 <treecols>
  27.                     <treecol 
  28.                         id="dwhelper-media-list-col0"
  29.                         anonid="xCol0"
  30.                         xbl-persist="medialist-col0:width,ordinal,hidden,sortActive,sortDirection"
  31.                         primary="true"
  32.                         flex="1"
  33.                         label="&column.file-name;"
  34.                         sort="?url"
  35.                         />
  36.                     <splitter class="tree-splitter"/>
  37.                     <treecol 
  38.                         id="dwhelper-media-list-col1"
  39.                         anonid="xCol1"
  40.                         xbl-persist="medialist-col1:width,ordinal,hidden,sortActive,sortDirection"
  41.                         primary="false"
  42.                         flex="1"
  43.                         label="&column.media-url;"
  44.                         sort="?url"
  45.                         hidden="true"
  46.                         />
  47.                     <splitter class="tree-splitter"/>
  48.                     <treecol 
  49.                         id="dwhelper-media-list-col2"
  50.                         anonid="xCol2"
  51.                         xbl-persist="medialist-col2:width,ordinal,hidden,sortActive,sortDirection"
  52.                         primary="false"
  53.                         flex="1"
  54.                         label="&column.source-url;"
  55.                         sort="?pageurl"
  56.                         hidden="true"
  57.                         />
  58.                     <splitter class="tree-splitter"/>
  59.                     <treecol 
  60.                         id="dwhelper-media-list-col3"
  61.                         anonid="xCol3"
  62.                         primary="false"
  63.                         flex="1"
  64.                         label="&column.view-date;"
  65.                         xbl-persist="medialist-col3:width,ordinal,hidden,sortActive,sortDirection"
  66.                         sortActive="true" sortDirection="descending" 
  67.                         sort="?date"
  68.                         />
  69.                         
  70.                 </treecols>
  71.  
  72.                 <template>
  73.                     <rule>
  74.                         <conditions>
  75.                             <content uri="?root"/>
  76.                             <member container="?root" child="?media"/>
  77.                             <triple subject="?media"
  78.                                  predicate="http://downloadhelper.net/1.0#url"
  79.                                  object="?url"/>
  80.                         </conditions>
  81.                         <bindings>
  82.                             <binding subject="?media"
  83.                                  predicate="http://downloadhelper.net/1.0#filename"
  84.                                  object="?filename"/>
  85.                             <binding subject="?media"
  86.                                  predicate="http://downloadhelper.net/1.0#pageurl"
  87.                                  object="?pageurl"/>
  88.                             <binding subject="?media"
  89.                                  predicate="http://downloadhelper.net/1.0#date"
  90.                                  object="?date"/>
  91.                             <binding subject="?media"
  92.                                  predicate="http://downloadhelper.net/1.0#datestr"
  93.                                  object="?datestr"/>
  94.                           </bindings>
  95.                           <action>
  96.                             <treechildren>
  97.                                 <treeitem
  98.                                     uri="?media" open="true">
  99.                                     <treerow>
  100.                                         <treecell                
  101.                                             label="?filename"
  102.                                             />
  103.                                         <treecell                
  104.                                             label="?url"
  105.                                             />
  106.                                         <treecell                
  107.                                             label="?pageurl"
  108.                                             />
  109.                                         <treecell                
  110.                                             label="?datestr"
  111.                                             />
  112.                                     </treerow>
  113.                                 </treeitem>
  114.                             </treechildren>
  115.                         </action>
  116.                     </rule>
  117.                 </template>
  118.  
  119.             </tree>
  120.             <children style="display: none;"/>
  121.         </xbl:content>
  122.  
  123.         <implementation>
  124.  
  125.             <constructor>
  126.                 <![CDATA[
  127. this.util.setDatasource(this.xTree,this.mediaListMgr.getDataSource());
  128. setTimeout(function(_this) { _this.doMonitorXBLPersist=true; },0,this);
  129.                 ]]>
  130.             </constructor>
  131.             
  132.             <method name="setList">
  133.                 <parameter name="list"/>
  134.                 <body>
  135.                 <![CDATA[
  136. //dump("[media-list] setList("+list+")\n");
  137. this.list=list;
  138. if(list==null)
  139.     this.xTree.setAttribute("ref","urn:none");
  140. else
  141.     this.xTree.setAttribute("ref",list);
  142.                 ]]>
  143.                 </body>
  144.             </method>
  145.                         
  146.             <method name="getList">
  147.                 <body>
  148.                 <![CDATA[
  149. return this.list;
  150.                 ]]>
  151.                 </body>
  152.             </method>
  153.                         
  154.             <method name="getSelectedMedia">
  155.                 <body>
  156.                 <![CDATA[
  157. var selectCount = this.xTree.view.selection.count;
  158. if(selectCount>0) {
  159.     var res=this.xTree.builderView.getResourceAtIndex(this.xTree.currentIndex);
  160.     if(res!=null) {
  161.         return res.Value;
  162.     }
  163. }
  164. return null;
  165.                 ]]>
  166.                 </body>
  167.             </method>
  168.             
  169.             <method name="getSelectedMedias">
  170.                 <body>
  171.                 <![CDATA[
  172. var sel=[];
  173. try {
  174.     if(this.xTree.view==null)
  175.         return sel;
  176.     if(this.xTree.view.selection.count<1)
  177.         return sel;
  178.     if(this.xTree.builderView==null)
  179.         return sel;
  180.     var numRanges = this.xTree.view.selection.getRangeCount();
  181.     for (var t=0; t<numRanges; t++){
  182.         var start={};
  183.         var end={};
  184.           this.xTree.view.selection.getRangeAt(t,start,end);
  185.           for (var v=start.value; v<=end.value; v++) {
  186.               if(v>=0) {
  187.                 var res=this.xTree.builderView.getResourceAtIndex(v);
  188.                 sel.push(res);
  189.             }
  190.         }
  191.     }
  192.     return sel;
  193. } catch(e) {
  194.     return [];
  195. }
  196.  
  197.                 ]]>
  198.                 </body>
  199.             </method>
  200.  
  201.                         
  202.         </implementation>
  203.         
  204.         <handlers>
  205.             <handler event="dblclick">
  206.                 <![CDATA[
  207. this.fireEvent("MediaDblClicked");
  208.                 ]]>
  209.             </handler>
  210.  
  211.             <handler event="select">
  212.                 <![CDATA[
  213. this.fireEvent("MediaSelect");
  214.                 ]]>
  215.             </handler>
  216.  
  217.         </handlers>
  218.                 
  219.     </binding>
  220.  
  221. </bindings>
  222.